#pragma once
#include"RBtree.h"
namespace ly {
	template<class T>
	class set {
	public:
		struct SetKeyoft {
			const T& operator()(const T& a) {
				return a;
			}
		};
		typedef ly::Node<const T> Node;
		typedef typename rbtree<const T, const T, SetKeyoft>::iterator iterator;
		typedef typename rbtree<const T, const T, SetKeyoft>::const_iterator const_iterator;

		pair<iterator, bool> insert(const T k) {
			Node* t= _root.insert(k);
			bool ok = true;
			if (t == nullptr) {
				ok = false;
			}
			return  { t,ok };
		}
		iterator find(const T& key) {
			return _root.find(key);
		}
		iterator begin() {
			return _root.ConstBegin();
		}
		iterator end() {
			return _root.ConstEnd();
		}
		iterator lower_bound(const T& key) {
			return _root.lower_bound(key);
		}
		iterator upper_bound(const T& key) {
			return _root.upper_bound(key);
		}
	private:
		ly::rbtree<const T, const T, SetKeyoft> _root;
	};
}